home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / ShoveIt Deluxe™ by wsanchez / DropScript Source / script < prev   
Encoding:
Text File  |  2000-06-23  |  2.2 KB  |  77 lines

  1. #!/bin/sh
  2. ##
  3. # DropScript seed script
  4. #
  5. # Wilfredo Sanchez | wsanchez@apple.com
  6. # Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  7. ##
  8. # @APPLE_LICENSE_HEADER_START@
  9. # The contents of this file constitute Original Code as defined in and
  10. # are subject to the Apple Public Source License Version 1.1 (the
  11. # "License").  You may not use this file except in compliance with the
  12. # License.  Please obtain a copy of the License at
  13. # http://www.apple.com/publicsource and read it before using this file.
  14. # This Original Code and all software distributed under the License are
  15. # distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  16. # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  17. # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  18. # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  19. # License for the specific language governing rights and limitations
  20. # under the License.
  21. # @APPLE_LICENSE_HEADER_END@
  22. ##
  23.  
  24. # For debugging
  25. #set -e
  26. #set -u
  27. #set -x
  28.  
  29. ScriptFileName=$1; shift;
  30.  
  31. if [ $# != 0 ]; then
  32.     echo "Too many arguments."
  33.     exit 64;
  34. fi;
  35.  
  36.  DropScript="/System/Demos/DropScript.app";
  37. Destination=$(dirname "${ScriptFileName}");
  38. DropperName="Drop"$(basename "${ScriptFileName}" | sed 's/\..*$//');
  39.  NewDropper="${Destination}/${DropperName}.app";
  40.  
  41. if [ ! -f "${ScriptFileName}" ]; then
  42.     echo "Invalid program ${ScriptFileName}.";
  43.     exit 65;
  44. fi;
  45.  
  46. if [ ! -d "${DropScript}" ]; then
  47.     echo "Unable to find DropScript application.";
  48.     exit 72;
  49. fi;
  50.  
  51. if ! cd "${DropScript}"; then
  52.     echo "Unable to open ${DropScript}.";
  53.     exit 66;
  54. fi;
  55.  
  56. if ! mkdir "${NewDropper}" ||
  57.    ! pax -rw . "${NewDropper}"; then
  58.     echo "Unable to create ${NewDropper}.";
  59.     echo "You may have a partially created drop app.";
  60.     exit 73;
  61. fi;
  62.  
  63. if ! cp -f "${ScriptFileName}" "${NewDropper}/Contents/Resources/script"; then
  64.     echo "Unable to write script into ${NewDropper}.app";
  65.     echo "You may have a partially created drop app.";
  66.     exit 73;
  67. fi;
  68.  
  69. if ! chmod 555 "${NewDropper}/Contents/Resources/script"; then
  70.     echo "Unable to set mode for script.";
  71.     echo "You may have a partially created drop app.";
  72.     exit 73;
  73. fi;
  74.